﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Admin.Core.Common.Input;
using Admin.Core.Common.Output;
using Admin.Core.Common.ParamInput;
using Admin.Core.Service.Warehouse.StockIn;
using Admin.Core.Service.Warehouse.StockIn.Input;
using Admin.Core.Service.Warehouse.StockOut;
using Admin.Core.Service.Warehouse.StockOut.Input;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace Admin.Core.Controllers.Warehouse
{
    public class StockOutController : AreaController
    {
        //private readonly IXbcMaterrialService _xbcMaterrialService;
        private readonly IStockOutService _stockOutService;
        private readonly IStockInService _stockInService;
        public StockOutController(
            IStockInService stockInService,
            //IXbcMaterrialService xbcMaterrialService, 
            IStockOutService stockOutService)
        {
            //_xbcMaterrialService = xbcMaterrialService;
            _stockInService = stockInService;
            _stockOutService = stockOutService;
        }

        /// <summary>
        /// 分页查询库存入库信息
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<IResponseOutput> GetPage(PageInput<StockOutFilterInput> model)
        {
            return await _stockOutService.PageAsync(model);
        }

        /// <summary>
        /// 分页查询库存入库信息
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<IResponseOutput> GetKcPage(PageInput<StockInCkFilterInput> model)
        {
            return await _stockInService.PageKcAsync(model);
        }
        
        ///// <summary>
        ///// 根据物料id物料规格信息
        ///// </summary>
        ///// <returns></returns>
        //[HttpGet]
        //public async Task<IResponseOutput> GetMaterInfo(long id)
        //{
        //    return await _xbcMaterrialService.GetMaterDetailAsync(id);
        //}

        /// <summary>
        /// 新增入库
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<IResponseOutput> Add(List<StockOutAddInput> input)
        {
            return await _stockOutService.AddAsync(input);
        }
    }
}